package com.example.demo.controller;

import com.example.demo.bean.Warehouse;
import com.example.demo.sevice.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class WarehouseController {

    @Autowired
    private WarehouseService warehouseService;

    @RequestMapping("/warehouse")
    private List<Warehouse> warehouse(int id) {
        return warehouseService.warehouse(id);
    }

    @RequestMapping("/warehouse1")
    private void insert(Warehouse warehouse) {
        warehouseService.insert(warehouse);
    }

    @RequestMapping("/warehouse2")
    private void delete(int id) {
        warehouseService.delete(id);
    }

    @RequestMapping("/warehouse3")
    private void update(Warehouse warehouse) {
        System.out.println(warehouse);
        warehouseService.update(warehouse);
    }
}
